<!DOCTYPE html>
<html id="docs" lang="en" class="">
	<head>
	<meta charset="utf-8">
<title>Pod Lifecycle - Kubernetes</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/png" href="../../../images/favicon.png">
<link rel="stylesheet" type="text/css" href="../../../css/base_fonts.css">
<link rel="stylesheet" type="text/css" href="../../../css/styles.css">
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">
<link rel="stylesheet" type="text/css" href="../../../css/callouts.css">
<link rel="stylesheet" type="text/css" href="../../../css/custom-jekyll/tags.css">




<meta name="description" content="Pod Lifecycle" />
<meta property="og:description" content="Pod Lifecycle" />

<meta property="og:url" content="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/" />
<meta property="og:title" content="Pod Lifecycle - Kubernetes" />

<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
<script src="../../../js/script.js"></script>
<script src="../../../js/custom-jekyll/tags.js"></script>


	</head>
	<body>
		<div id="cellophane" onclick="kub.toggleMenu()"></div>

<header>
    <a href="../../../index.html" class="logo"></a>

    <div class="nav-buttons" data-auto-burger="primary">
        <ul class="global-nav">
            
            
            <li><a href="../../home.1">Documentation</a></li>
            
            <li><a href="../../../blog/index.html">Blog</a></li>
            
            <li><a href="../../../partners/index.html">Partners</a></li>
            
            <li><a href="../../../community/index.html">Community</a></li>
            
            <li><a href="../../../case-studies/index.html">Case Studies</a></li>
            
            
             <li>
                <a href="index.html#">
                    English <span class="ui-icon ui-icon-carat-1-s"></span>
                </a>
                <ul>
                
                    <li><a href="../../../zh/index.html">中文 Chinese</a></li>
                
                    <li><a href="../../../ko/index.html">한국어 Korean</a></li>
                
                </ul>
            </li>
         
            <li>
                <a href="index.html#">
                    v1.11 <span class="ui-icon ui-icon-carat-1-s"></span>
                </a>
                <ul>
                
                    <li><a href="https://kubernetes.io">v1.12</a></li>
                
                    <li><a href="../../../index.html">v1.11</a></li>
                
                    <li><a href="https://v1-10.docs.kubernetes.io">v1.10</a></li>
                
                    <li><a href="https://v1-9.docs.kubernetes.io">v1.9</a></li>
                
                </ul>
            </li>
        </ul>
        
        <a href="../../tutorials/kubernetes-basics/index.html" class="button" id="tryKubernetes" data-auto-burger-exclude>Try Kubernetes</a>
        <button id="hamburger" onclick="kub.toggleMenu()" data-auto-burger-exclude><div></div></button>
    </div>

    <nav id="mainNav">
        <main data-auto-burger="primary">
        <div class="nav-box">
            <h3><a href="../../tutorials/stateless-application/hello-minikube/index.html">Get Started</a></h3>
            <p>Ready to get your hands dirty? Build a simple Kubernetes cluster that runs "Hello World" for Node.js.</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../home.1">Documentation</a></h3>
            <p>Learn how to use Kubernetes with the use of walkthroughs, samples, and reference documentation. You can even <a href="../../../editdocs/index.html" data-auto-burger-exclude>help contribute to the docs</a>!</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../../community/index.html">Community</a></h3>
            <p>If you need help, you can connect with other Kubernetes users and the Kubernetes authors, attend community events, and watch video presentations from around the web.</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../../blog/index.html">Blog</a></h3>
            <p>Read the latest news for Kubernetes and the containers space in general, and get technical how-tos hot off the presses.</p>
        </div>
        </main>
        <main data-auto-burger="primary">
        <div class="left">
            <h5 class="github-invite">Interested in hacking on the core Kubernetes code base?</h5>
            <a href="https://github.com/kubernetes/kubernetes" class="button" data-auto-burger-exclude>View On Github</a>
        </div>

        <div class="right">
            <h5 class="github-invite">Explore the community</h5>
            <div class="social">
                <a href="https://twitter.com/kubernetesio" class="twitter"><span>Twitter</span></a>
                <a href="https://github.com/kubernetes/kubernetes" class="github"><span>Github</span></a>
                <a href="http://slack.k8s.io/" class="slack"><span>Slack</span></a>
                <a href="http://stackoverflow.com/questions/tagged/kubernetes" class="stack-overflow"><span>Stack Overflow</span></a>
                <a href="https://discuss.kubernetes.io" class="mailing-list"><span>Forum</span></a>
                <a href="https://calendar.google.com/calendar/embed?src=nt2tcnbtbied3l6gi2h29slvc0%40group.calendar.google.com" class="calendar"><span>Events Calendar</span></a>
            </div>
        </div>
        <div class="clear" style="clear: both"></div>
        </main>
    </nav>
</header>

		
		
		<section id="hero" class="light-text no-sub">
			









<h1>Concepts</h1>
<h5></h5>








<div id="vendorStrip" class="light-text">
	<ul>
		
		
		<li><a href="../../home.1">DOCUMENTATION</a></li>
		
		
		<li><a href="../../setup/index.html">SETUP</a></li>
		
		
		<li><a href="../../concepts/index.html" class="YAH">CONCEPTS</a></li>
		
		
		<li><a href="../../tasks/index.html">TASKS</a></li>
		
		
		<li><a href="../../tutorials/index.html">TUTORIALS</a></li>
		
		
		<li><a href="../../reference.1">REFERENCE</a></li>
		
	</ul>
	<div id="searchBox">
		<input type="text" id="search" placeholder="Search" onkeydown="if (event.keyCode==13) window.location.replace('/docs/search/?q=' + this.value)" autofocus="autofocus">
	</div>
</div>

		</section>
		
		
<section id="deprecationWarning">
  <main>
    <div class="content deprecation-warning">
      <h3>
        Documentation for Kubernetes v1.11 is no longer actively maintained. The version you are currently viewing is a static snapshot.
        For up-to-date documentation, see the <a href="https://kubernetes.io/docs/home/">latest</a> version.
      </h3>
    </div>
  </main>
</section>


		<section id="encyclopedia">
			
<div id="docsToc">
     <div class="pi-accordion">
    	
        
        
        
        
        
         
             
                 
             
         
             
                 
             
         
             
                 
                          
                          
                 
             
         
             
         
             
         
             
         
             
         
             
         
         
        
        <a class="item" data-title="Concepts" href="../../concepts/index.html"></a>

	
	
		
		
	<div class="item" data-title="Overview">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="What is Kubernetes?" href="../../concepts/overview/index.html"></a>

		
	
		
		
<a class="item" data-title="Kubernetes Components" href="../../concepts/overview/components.1"></a>

		
	
		
		
<a class="item" data-title="The Kubernetes API" href="../../concepts/overview/kubernetes-api/index.html"></a>

		
	
		
		
	<div class="item" data-title="Working with Kubernetes Objects">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Understanding Kubernetes Objects" href="../../concepts/overview/working-with-objects/kubernetes-objects.1"></a>

		
	
		
		
<a class="item" data-title="Names" href="../identifiers"></a>

		
	
		
		
<a class="item" data-title="Namespaces" href="../../concepts/overview/working-with-objects/namespaces.1"></a>

		
	
		
		
<a class="item" data-title="Labels and Selectors" href="../labels"></a>

		
	
		
		
<a class="item" data-title="Annotations" href="../../concepts/overview/working-with-objects/annotations.1"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Object Management Using kubectl">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Kubernetes Object Management" href="../../tutorials/object-management-kubectl/object-management/index.html"></a>

		
	
		
		
<a class="item" data-title="Managing Kubernetes Objects Using Imperative Commands" href="../../tutorials/object-management-kubectl/imperative-object-management-command/index.html"></a>

		
	
		
		
<a class="item" data-title="Imperative Management of Kubernetes Objects Using Configuration Files" href="../../tutorials/object-management-kubectl/imperative-object-management-configuration/index.html"></a>

		
	
		
		
<a class="item" data-title="Declarative Management of Kubernetes Objects Using Configuration Files" href="../../tutorials/object-management-kubectl/declarative-object-management-configuration/index.html"></a>

		
	

		</div>
	</div>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Compute, Storage, and Networking Extensions">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Cluster Administration Overview" href="../../concepts/cluster-administration/cluster-administration-overview/index.html"></a>

		
	
		
		
<a class="item" data-title="Certificates" href="../../concepts/cluster-administration/certificates/index.html"></a>

		
	
		
		
<a class="item" data-title="Cloud Providers" href="../../concepts/cluster-administration/cloud-providers/index.html"></a>

		
	
		
		
<a class="item" data-title="Managing Resources" href="../../concepts/cluster-administration/manage-deployment/index.html"></a>

		
	
		
		
<a class="item" data-title="Cluster Networking" href="../../admin/networking"></a>

		
	
		
		
<a class="item" data-title="Logging Architecture" href="../../concepts/cluster-administration/logging.1"></a>

		
	
		
		
<a class="item" data-title="Configuring kubelet Garbage Collection" href="../../concepts/cluster-administration/kubelet-garbage-collection/index.html"></a>

		
	
		
		
<a class="item" data-title="Federation" href="../../concepts/cluster-administration/federation/index.html"></a>

		
	
		
		
<a class="item" data-title="Proxies in Kubernetes" href="../../concepts/cluster-administration/proxies/index.html"></a>

		
	
		
		
<a class="item" data-title="Controller manager metrics" href="../../concepts/cluster-administration/controller-metrics/index.html"></a>

		
	
		
		
<a class="item" data-title="Installing Addons" href="../../concepts/cluster-administration/addons/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Kubernetes Architecture">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Nodes" href="../../admin/node.1"></a>

		
	
		
		
<a class="item" data-title="Master-Node communication" href="../../concepts/architecture/master-node-communication/index.html"></a>

		
	
		
		
<a class="item" data-title="Concepts Underlying the Cloud Controller Manager" href="../../concepts/architecture/cloud-controller/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Extending Kubernetes">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Extending your Kubernetes Cluster" href="../../concepts/overview/extending/index.html"></a>

		
	
		
		
	<div class="item" data-title="Extending the Kubernetes API">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Extending the Kubernetes API with the aggregation layer" href="../../concepts/api-extension/apiserver-aggregation.1"></a>

		
	
		
		
<a class="item" data-title="Custom Resources" href="../../concepts/api-extension/custom-resources/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Compute, Storage, and Networking Extensions">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Network Plugins" href="../../admin/network-plugins/index.html"></a>

		
	
		
		
<a class="item" data-title="Device Plugins" href="../../concepts/cluster-administration/device-plugins.1"></a>

		
	

		</div>
	</div>

		
	
		
		
<a class="item" data-title="Service Catalog" href="../../concepts/service-catalog/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Containers">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Images" href="../../concepts/containers/images/index.html"></a>

		
	
		
		
<a class="item" data-title="Container Environment Variables" href="../../concepts/containers/container-environment-variables/index.html"></a>

		
	
		
		
<a class="item" data-title="Container Lifecycle Hooks" href="../../concepts/containers/container-lifecycle-hooks/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Workloads">
		<div class="container">
		
		
	
	
		
		
	<div class="item" data-title="Pods">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Pod Overview" href="../../concepts/workloads/pods/pod-overview/index.html"></a>

		
	
		
		
<a class="item" data-title="Pods" href="../pods/index.html"></a>

		
	
		
		
<a class="item" data-title="Pod Lifecycle" href="index.html"></a>

		
	
		
		
<a class="item" data-title="Init Containers" href="../../concepts/abstractions/init-containers/index.html"></a>

		
	
		
		
<a class="item" data-title="Pod Preset" href="../../concepts/workloads/pods/podpreset/index.html"></a>

		
	
		
		
<a class="item" data-title="Disruptions" href="../../concepts/workloads/pods/disruptions/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Controllers">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="ReplicaSet" href="../../concepts/workloads/controllers/replicaset/index.html"></a>

		
	
		
		
<a class="item" data-title="ReplicationController" href="../replication-controller/index.html"></a>

		
	
		
		
<a class="item" data-title="Deployments" href="../../concepts/workloads/controllers/deployment/index.html"></a>

		
	
		
		
<a class="item" data-title="StatefulSets" href="../../concepts/workloads/controllers/statefulset.md"></a>

		
	
		
		
<a class="item" data-title="DaemonSet" href="../../concepts/workloads/controllers/daemonset.1"></a>

		
	
		
		
<a class="item" data-title="Garbage Collection" href="../../concepts/workloads/controllers/garbage-collection/index.html"></a>

		
	
		
		
<a class="item" data-title="Jobs - Run to Completion" href="../../concepts/workloads/controllers/jobs-run-to-completion.1"></a>

		
	
		
		
<a class="item" data-title="CronJob" href="../../concepts/workloads/controllers/cron-jobs.1"></a>

		
	

		</div>
	</div>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Configuration">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Configuration Best Practices" href="../../concepts/configuration/overview/index.html"></a>

		
	
		
		
<a class="item" data-title="Managing Compute Resources for Containers" href="../compute-resources/index.html"></a>

		
	
		
		
<a class="item" data-title="Assigning Pods to Nodes" href="../node-selection/index.html"></a>

		
	
		
		
<a class="item" data-title="Taints and Tolerations" href="../../concepts/configuration/taint-and-toleration.1"></a>

		
	
		
		
<a class="item" data-title="Secrets" href="../secrets.1"></a>

		
	
		
		
<a class="item" data-title="Organizing Cluster Access Using kubeconfig Files" href="../../concepts/configuration/organize-cluster-access-kubeconfig/index.html"></a>

		
	
		
		
<a class="item" data-title="Pod Priority and Preemption" href="../../concepts/configuration/pod-priority-preemption/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Services, Load Balancing, and Networking">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Services" href="../services"></a>

		
	
		
		
<a class="item" data-title="DNS for Services and Pods" href="../../concepts/services-networking/dns-pod-service/index.html"></a>

		
	
		
		
<a class="item" data-title="Connecting Applications with Services" href="../../concepts/services-networking/connect-applications-service.1"></a>

		
	
		
		
<a class="item" data-title="Ingress" href="../../concepts/services-networking/ingress/index.html"></a>

		
	
		
		
<a class="item" data-title="Network Policies" href="../../concepts/services-networking/networkpolicies/index.html"></a>

		
	
		
		
<a class="item" data-title="Adding entries to Pod /etc/hosts with HostAliases" href="../../concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Storage">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Volumes" href="../../concepts/storage/volumes.1"></a>

		
	
		
		
<a class="item" data-title="Persistent Volumes" href="../persistent-volumes/index.html"></a>

		
	
		
		
<a class="item" data-title="Storage Classes" href="../../concepts/storage/storage-classes.1"></a>

		
	
		
		
<a class="item" data-title="Dynamic Volume Provisioning" href="../../concepts/storage/dynamic-provisioning/index.html"></a>

		
	
		
		
<a class="item" data-title="Node-specific Volume Limits" href="../../concepts/storage/storage-limits/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Policies">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Resource Quotas" href="../../concepts/policy/resource-quotas/index.html"></a>

		
	
		
		
<a class="item" data-title="Pod Security Policies" href="../pod-security-policy"></a>

		
	

		</div>
	</div>

		
	






     </div> 
    <button class="push-menu-close-button" onclick="kub.toggleToc()"></button>
</div> 

			<div id="docsContent">
				
<p><a href="../../editdocs#docs/concepts/workloads/pods/pod-lifecycle.md" id="editPageButton">Edit This Page</a></p>

<h1>Pod Lifecycle</h1>



<p>This page describes the lifecycle of a Pod.</p>









<ul id="markdown-toc">










<li><a href="index.html#pod-phase">Pod phase</a></li>




<li><a href="index.html#pod-conditions">Pod conditions</a></li>




<li><a href="index.html#container-probes">Container probes</a></li>




<li><a href="index.html#pod-and-container-status">Pod and Container status</a></li>




<li><a href="index.html#pod-readiness-gate">Pod readiness gate</a></li>




<li><a href="index.html#restart-policy">Restart policy</a></li>




<li><a href="index.html#pod-lifetime">Pod lifetime</a></li>




<li><a href="index.html#examples">Examples</a></li>




















<li><a href="index.html#what-s-next">What's next</a></li>



</ul>


<h2 id="pod-phase">Pod phase</h2>

<p>A Pod&rsquo;s <code>status</code> field is a
<a href="../../reference/generated/kubernetes-api/v1.11/index.html#podstatus-v1-core">PodStatus</a>
object, which has a <code>phase</code> field.</p>

<p>The phase of a Pod is a simple, high-level summary of where the Pod is in its
lifecycle. The phase is not intended to be a comprehensive rollup of observations
of Container or Pod state, nor is it intended to be a comprehensive state machine.</p>

<p>The number and meanings of Pod phase values are tightly guarded.
Other than what is documented here, nothing should be assumed about Pods that
have a given <code>phase</code> value.</p>

<p>Here are the possible values for <code>phase</code>:</p>

<table>
<thead>
<tr>
<th align="left">Value</th>
<th align="left">Description</th>
</tr>
</thead>

<tbody>
<tr>
<td align="left"><code>Pending</code></td>
<td align="left">The Pod has been accepted by the Kubernetes system, but one or more of the Container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while.</td>
</tr>

<tr>
<td align="left"><code>Running</code></td>
<td align="left">The Pod has been bound to a node, and all of the Containers have been created. At least one Container is still running, or is in the process of starting or restarting.</td>
</tr>

<tr>
<td align="left"><code>Succeeded</code></td>
<td align="left">All Containers in the Pod have terminated in success, and will not be restarted.</td>
</tr>

<tr>
<td align="left"><code>Failed</code></td>
<td align="left">All Containers in the Pod have terminated, and at least one Container has terminated in failure. That is, the Container either exited with non-zero status or was terminated by the system.</td>
</tr>

<tr>
<td align="left"><code>Unknown</code></td>
<td align="left">For some reason the state of the Pod could not be obtained, typically due to an error in communicating with the host of the Pod.</td>
</tr>
</tbody>
</table>

<h2 id="pod-conditions">Pod conditions</h2>

<p>A Pod has a PodStatus, which has an array of
<a href="../../reference/generated/kubernetes-api/v1.11/index.html#podcondition-v1-core">PodConditions</a>
through which the Pod has or has not passed. Each element of the PodCondition
array has six possible fields:</p>

<ul>
<li><p>The <code>lastProbeTime</code> field provides a timestamp for when the Pod condition
was last probed.</p></li>

<li><p>The <code>lastTransitionTime</code> field provides a timestamp for when the Pod
last transitioned from one status to another.</p></li>

<li><p>The <code>message</code> field is a human-readable message indicating details
about the transition.</p></li>
</ul>

<p>A Pod has a PodStatus, which has an array of
<a href="../../reference/generated/kubernetes-api/v1.11/index.html#podcondition-v1-core">PodConditions</a>. Each element
of the PodCondition array has a <code>type</code> field and a <code>status</code> field. The <code>type</code>
field is a string with the following possible values:</p>

<ul>
<li><code>PodScheduled</code>: the Pod has been scheduled to a node;</li>
<li><code>Ready</code>: the Pod is able to serve requests and should be added to the load
balancing pools of all matching Services;</li>
<li><code>Initialized</code>: all <a href="../../concepts/workloads/pods/init-containers.1">init containers</a>
have started successfully;</li>
<li><code>Unschedulable</code>: the scheduler cannot schedule the Pod right now, for example
due to lacking of resources or other constraints;</li>
<li><code>ContainersReady</code>: all containers in the Pod are ready.</li>
</ul>

<p>The <code>status</code> field is a string, with possible values &ldquo;<code>True</code>&rdquo;, &ldquo;<code>False</code>&rdquo;, and
&ldquo;<code>Unknown</code>&rdquo;.</p>

<h2 id="container-probes">Container probes</h2>

<p>A <a href="../../reference/generated/kubernetes-api/v1.11/index.html#probe-v1-core">Probe</a> is a diagnostic
performed periodically by the <a href="../../admin/kubelet/index.html">kubelet</a>
on a Container. To perform a diagnostic,
the kubelet calls a
<a href="https://godoc.org/k8s.io/kubernetes/pkg/api/v1#Handler" target="_blank">Handler</a> implemented by
the Container. There are three types of handlers:</p>

<ul>
<li><p><a href="../../reference/generated/kubernetes-api/v1.11/index.html#execaction-v1-core">ExecAction</a>:
Executes a specified command inside the Container. The diagnostic
is considered successful if the command exits with a status code of 0.</p></li>

<li><p><a href="../../reference/generated/kubernetes-api/v1.11/index.html#tcpsocketaction-v1-core">TCPSocketAction</a>:
Performs a TCP check against the Container&rsquo;s IP address on
a specified port. The diagnostic is considered successful if the port is open.</p></li>

<li><p><a href="../../reference/generated/kubernetes-api/v1.11/index.html#httpgetaction-v1-core">HTTPGetAction</a>:
Performs an HTTP Get request against the Container&rsquo;s IP
address on a specified port and path. The diagnostic is considered successful
if the response has a status code greater than or equal to 200 and less than 400.</p></li>
</ul>

<p>Each probe has one of three results:</p>

<ul>
<li>Success: The Container passed the diagnostic.</li>
<li>Failure: The Container failed the diagnostic.</li>
<li>Unknown: The diagnostic failed, so no action should be taken.</li>
</ul>

<p>The kubelet can optionally perform and react to two kinds of probes on running
Containers:</p>

<ul>
<li><p><code>livenessProbe</code>: Indicates whether the Container is running. If
the liveness probe fails, the kubelet kills the Container, and the Container
is subjected to its <a href="index.html#restart-policy">restart policy</a>. If a Container does not
provide a liveness probe, the default state is <code>Success</code>.</p></li>

<li><p><code>readinessProbe</code>: Indicates whether the Container is ready to service requests.
If the readiness probe fails, the endpoints controller removes the Pod&rsquo;s IP
address from the endpoints of all Services that match the Pod. The default
state of readiness before the initial delay is <code>Failure</code>. If a Container does
not provide a readiness probe, the default state is <code>Success</code>.</p></li>
</ul>

<h3 id="when-should-you-use-liveness-or-readiness-probes">When should you use liveness or readiness probes?</h3>

<p>If the process in your Container is able to crash on its own whenever it
encounters an issue or becomes unhealthy, you do not necessarily need a liveness
probe; the kubelet will automatically perform the correct action in accordance
with the Pod&rsquo;s <code>restartPolicy</code>.</p>

<p>If you&rsquo;d like your Container to be killed and restarted if a probe fails, then
specify a liveness probe, and specify a <code>restartPolicy</code> of Always or OnFailure.</p>

<p>If you&rsquo;d like to start sending traffic to a Pod only when a probe succeeds,
specify a readiness probe. In this case, the readiness probe might be the same
as the liveness probe, but the existence of the readiness probe in the spec means
that the Pod will start without receiving any traffic and only start receiving
traffic after the probe starts succeeding.</p>

<p>If your Container needs to work on loading large data, configuration files, or migrations during startup, specify a readiness probe.</p>

<p>If you want your Container to be able to take itself down for maintenance, you
can specify a readiness probe that checks an endpoint specific to readiness that
is different from the liveness probe.</p>

<p>Note that if you just want to be able to drain requests when the Pod is deleted,
you do not necessarily need a readiness probe; on deletion, the Pod automatically
puts itself into an unready state regardless of whether the readiness probe exists.
The Pod remains in the unready state while it waits for the Containers in the Pod
to stop.</p>

<p>For more information about how to set up a liveness or readiness probe, see
<a href="../liveness/index.html">Configure Liveness and Readiness Probes</a>.</p>

<h2 id="pod-and-container-status">Pod and Container status</h2>

<p>For detailed information about Pod Container status, see
<a href="../../reference/generated/kubernetes-api/v1.11/index.html#podstatus-v1-core">PodStatus</a>
and
<a href="../../reference/generated/kubernetes-api/v1.11/index.html#containerstatus-v1-core">ContainerStatus</a>.
Note that the information reported as Pod status depends on the current
<a href="../../reference/generated/kubernetes-api/v1.11/index.html#containerstatus-v1-core">ContainerState</a>.</p>

<h2 id="pod-readiness-gate">Pod readiness gate</h2>

<div style="margin-top: 10px; margin-bottom: 10px;">



<b>FEATURE STATE:</b> <code>Kubernetes v1.11</code>




    
    
    
    
    
<a href="index.html#" id="feature-state-dialog-link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>alpha</a>
<div id="feature-state-dialog" class="ui-dialog-content" title="alpha">
This feature is currently in a <em>alpha</em> state, meaning:</p>

<ul>
<li>The version names contain alpha (e.g. v1alpha1).</li>
<li>Might be buggy. Enabling the feature may expose bugs. Disabled by default.</li>
<li>Support for feature may be dropped at any time without notice.</li>
<li>The API may change in incompatible ways in a later software release without notice.</li>
<li>Recommended for use only in short-lived testing clusters, due to increased risk of bugs and lack of long-term support.</li>
</ul>

</div>
<script>
$(function(){
    
    $( "#feature-state-dialog" ).dialog({
        autoOpen: false,
        width: "600",
        buttons: [
            {
                text: "Ok",
                click: function() {
                    $( this ).dialog( "close" );
                }
            }
        ]
    });

    
    $( "#feature-state-dialog-link" ).click(function( event ) {
        $( "#feature-state-dialog" ).dialog( "open" );
        event.preventDefault();
    });

});
</script>

    

</div>

<p>In order to add extensibility to Pod readiness by enabling the injection of
extra feedbacks or signals into <code>PodStatus</code>, Kubernetes 1.11 introduced a
feature named <a href="https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md" target="_blank">Pod ready++</a>.
You can use the new field <code>ReadinessGate</code> in the <code>PodSpec</code> to specify additional
conditions to be evaluated for Pod readiness. If Kubernetes cannot find such a
condition in the <code>status.conditions</code> field of a Pod, the status of the condition
is default to &ldquo;<code>False</code>&rdquo;. Below is an example:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">Kind:<span style="color:#bbb"> </span>Pod<span style="color:#bbb">
</span><span style="color:#bbb"></span>...<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>readinessGates:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>conditionType:<span style="color:#bbb"> </span><span style="color:#b44">&#34;www.example.com/feature-1&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>status:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>conditions:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>type:<span style="color:#bbb"> </span>Ready<span style="color:#bbb">  </span><span style="color:#080;font-style:italic"># this is a builtin PodCondition</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>status:<span style="color:#bbb"> </span><span style="color:#b44">&#34;True&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>lastProbeTime:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">null</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>lastTransitionTime:<span style="color:#bbb"> </span>2018-01-01T00:00:00Z<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>type:<span style="color:#bbb"> </span><span style="color:#b44">&#34;www.example.com/feature-1&#34;</span><span style="color:#bbb">   </span><span style="color:#080;font-style:italic"># an extra PodCondition</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>status:<span style="color:#bbb"> </span><span style="color:#b44">&#34;False&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>lastProbeTIme:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">null</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>lastTransitionTime:<span style="color:#bbb"> </span>2018-01-01T00:00:00Z<span style="color:#bbb">
</span><span style="color:#bbb">  </span>containerStatuses:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>containerID:<span style="color:#bbb"> </span>docker://abcd...<span style="color:#bbb">
</span><span style="color:#bbb">      </span>ready:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">true</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>...</code></pre></div>
<p>The new Pod conditions must comply with Kubernetes <a href="../labels#syntax-and-character-set">label key format</a>.
Since the <code>kubectl patch</code> command still doesn&rsquo;t support patching object status,
the new Pod conditions have to be injected through the <code>PATCH</code> action using
one of the <a href="https://v1-11.docs.kubernetes.io/docs/reference/using-api/client-librarie/">KubeClient libraries</a>.</p>

<p>With the introduction of new Pod conditions, a Pod is evaluated to be ready <strong>only</strong>
when both the following statements are true:</p>

<ul>
<li>All containers in the Pod are ready.</li>
<li>All conditions specified in <code>ReadinessGates</code> are &ldquo;<code>True</code>&rdquo;.</li>
</ul>

<p>To facilitate this change to Pod readiness evaluation, a new Pod condition
<code>ContainersReady</code> is introduced to capture the old Pod <code>Ready</code> condition.</p>

<p>As an alpha feature, the &ldquo;Pod Ready++&rdquo; feature has to be explicitly enabled by
setting the <code>PodReadinessGates</code> <a href="../../reference/command-line-tools-reference/feature-gates/index.html">feature gate</a>
to True.</p>

<h2 id="restart-policy">Restart policy</h2>

<p>A PodSpec has a <code>restartPolicy</code> field with possible values Always, OnFailure,
and Never. The default value is Always.
<code>restartPolicy</code> applies to all Containers in the Pod. <code>restartPolicy</code> only
refers to restarts of the Containers by the kubelet on the same node. Exited
Containers that are restarted by the kubelet are restarted with an exponential
back-off delay (10s, 20s, 40s &hellip;) capped at five minutes, and is reset after ten
minutes of successful execution. As discussed in the
<a href="../pods/index.html#durability-of-pods-or-lack-thereof">Pods document</a>,
once bound to a node, a Pod will never be rebound to another node.</p>

<h2 id="pod-lifetime">Pod lifetime</h2>

<p>In general, Pods do not disappear until someone destroys them. This might be a
human or a controller. The only exception to
this rule is that Pods with a <code>phase</code> of Succeeded or Failed for more than some
duration (determined by <code>terminated-pod-gc-threshold</code> in the master) will expire and be automatically destroyed.</p>

<p>Three types of controllers are available:</p>

<ul>
<li><p>Use a <a href="../../concepts/jobs/run-to-completion-finite-workloads/index.html">Job</a> for Pods that are expected to terminate,
for example, batch computations. Jobs are appropriate only for Pods with
<code>restartPolicy</code> equal to OnFailure or Never.</p></li>

<li><p>Use a <a href="../replication-controller/index.html">ReplicationController</a>,
<a href="../../concepts/workloads/controllers/replicaset/index.html">ReplicaSet</a>, or
<a href="../../concepts/workloads/controllers/deployment/index.html">Deployment</a>
for Pods that are not expected to terminate, for example, web servers.
ReplicationControllers are appropriate only for Pods with a <code>restartPolicy</code> of
Always.</p></li>

<li><p>Use a <a href="../../concepts/workloads/controllers/daemonset.1">DaemonSet</a> for Pods that need to run one per
machine, because they provide a machine-specific system service.</p></li>
</ul>

<p>All three types of controllers contain a PodTemplate. It
is recommended to create the appropriate controller and let
it create Pods, rather than directly create Pods yourself. That is because Pods
alone are not resilient to machine failures, but controllers are.</p>

<p>If a node dies or is disconnected from the rest of the cluster, Kubernetes
applies a policy for setting the <code>phase</code> of all Pods on the lost node to Failed.</p>

<h2 id="examples">Examples</h2>

<h3 id="advanced-liveness-probe-example">Advanced liveness probe example</h3>

<p>Liveness probes are executed by the kubelet, so all requests are made in the
kubelet network namespace.</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Pod<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>labels:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>test:<span style="color:#bbb"> </span>liveness<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>liveness-http<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>containers:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>args:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>/server<span style="color:#bbb">
</span><span style="color:#bbb">    </span>image:<span style="color:#bbb"> </span>k8s.gcr.io/liveness<span style="color:#bbb">
</span><span style="color:#bbb">    </span>livenessProbe:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>httpGet:<span style="color:#bbb">
</span><span style="color:#bbb">        </span><span style="color:#080;font-style:italic"># when &#34;host&#34; is not defined, &#34;PodIP&#34; will be used</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span><span style="color:#080;font-style:italic"># host: my-host</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span><span style="color:#080;font-style:italic"># when &#34;scheme&#34; is not defined, &#34;HTTP&#34; scheme will be used. Only &#34;HTTP&#34; and &#34;HTTPS&#34; are allowed</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span><span style="color:#080;font-style:italic"># scheme: HTTPS</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span>path:<span style="color:#bbb"> </span>/healthz<span style="color:#bbb">
</span><span style="color:#bbb">        </span>port:<span style="color:#bbb"> </span><span style="color:#666">8080</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span>httpHeaders:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>X-Custom-Header<span style="color:#bbb">
</span><span style="color:#bbb">          </span>value:<span style="color:#bbb"> </span>Awesome<span style="color:#bbb">
</span><span style="color:#bbb">      </span>initialDelaySeconds:<span style="color:#bbb"> </span><span style="color:#666">15</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>timeoutSeconds:<span style="color:#bbb"> </span><span style="color:#666">1</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>name:<span style="color:#bbb"> </span>liveness</code></pre></div>
<h3 id="example-states">Example states</h3>

<ul>
<li><p>Pod is running and has one Container. Container exits with success.</p>

<ul>
<li>Log completion event.</li>
<li>If <code>restartPolicy</code> is:

<ul>
<li>Always: Restart Container; Pod <code>phase</code> stays Running.</li>
<li>OnFailure: Pod <code>phase</code> becomes Succeeded.</li>
<li>Never: Pod <code>phase</code> becomes Succeeded.</li>
</ul></li>
</ul></li>

<li><p>Pod is running and has one Container. Container exits with failure.</p>

<ul>
<li>Log failure event.</li>
<li>If <code>restartPolicy</code> is:

<ul>
<li>Always: Restart Container; Pod <code>phase</code> stays Running.</li>
<li>OnFailure: Restart Container; Pod <code>phase</code> stays Running.</li>
<li>Never: Pod <code>phase</code> becomes Failed.</li>
</ul></li>
</ul></li>

<li><p>Pod is running and has two Containers. Container 1 exits with failure.</p>

<ul>
<li>Log failure event.</li>
<li>If <code>restartPolicy</code> is:

<ul>
<li>Always: Restart Container; Pod <code>phase</code> stays Running.</li>
<li>OnFailure: Restart Container; Pod <code>phase</code> stays Running.</li>
<li>Never: Do not restart Container; Pod <code>phase</code> stays Running.</li>
</ul></li>
<li>If Container 1 is not running, and Container 2 exits:

<ul>
<li>Log failure event.</li>
<li>If <code>restartPolicy</code> is:

<ul>
<li>Always: Restart Container; Pod <code>phase</code> stays Running.</li>
<li>OnFailure: Restart Container; Pod <code>phase</code> stays Running.</li>
<li>Never: Pod <code>phase</code> becomes Failed.</li>
</ul></li>
</ul></li>
</ul></li>

<li><p>Pod is running and has one Container. Container runs out of memory.</p>

<ul>
<li>Container terminates in failure.</li>
<li>Log OOM event.</li>
<li>If <code>restartPolicy</code> is:

<ul>
<li>Always: Restart Container; Pod <code>phase</code> stays Running.</li>
<li>OnFailure: Restart Container; Pod <code>phase</code> stays Running.</li>
<li>Never: Log failure event; Pod <code>phase</code> becomes Failed.</li>
</ul></li>
</ul></li>

<li><p>Pod is running, and a disk dies.</p>

<ul>
<li>Kill all Containers.</li>
<li>Log appropriate event.</li>
<li>Pod <code>phase</code> becomes Failed.</li>
<li>If running under a controller, Pod is recreated elsewhere.</li>
</ul></li>

<li><p>Pod is running, and its node is segmented out.</p>

<ul>
<li>Node controller waits for timeout.</li>
<li>Node controller sets Pod <code>phase</code> to Failed.</li>
<li>If running under a controller, Pod is recreated elsewhere.</li>
</ul></li>
</ul>












<h2 id="what-s-next">What&#39;s next</h2>
<ul>
<li><p>Get hands-on experience
<a href="../../tasks/configure-pod-container/attach-handler-lifecycle-event/index.html">attaching handlers to Container lifecycle events</a>.</p></li>

<li><p>Get hands-on experience
<a href="../liveness/index.html">configuring liveness and readiness probes</a>.</p></li>

<li><p>Learn more about <a href="../../concepts/containers/container-lifecycle-hooks/index.html">Container lifecycle hooks</a>.</p></li>
</ul>






				<div class="issue-button-container">
					<p><a href="index.html"><img src="https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/concepts/workloads/pods/pod-lifecycle.md?pixel" alt="Analytics" /></a></p>
					
					
					<script type="text/javascript">
					PDRTJS_settings_8345992 = {
					"id" : "8345992",
					"unique_id" : "\/docs\/concepts\/workloads\/pods\/pod-lifecycle\/",
					"title" : "Pod Lifecycle",
					"permalink" : "https:\/\/kubernetes.io\/docs\/concepts\/workloads\/pods\/pod-lifecycle\/"
					};
					(function(d,c,j){if(!document.getElementById(j)){var pd=d.createElement(c),s;pd.id=j;pd.src=('https:'==document.location.protocol)?'https://polldaddy.com/js/rating/rating.js':'http://i0.poll.fm/js/rating/rating.js';s=document.getElementsByTagName(c)[0];s.parentNode.insertBefore(pd,s);}}(document,'script','pd-rating-js'));
					</script>
					<a href="index.html" onclick="window.open('https://github.com/kubernetes/website/issues/new?title=Issue%20with%20' +
					'k8s.io'+window.location.pathname)" class="button issue">Create an Issue</a>
					
					
					
					<a href="../../editdocs#docs/concepts/workloads/pods/pod-lifecycle.md" class="button issue">Edit this Page</a>
					
				</div>
			</div>
		</section>
		<footer>
    <main class="light-text">
        <nav>
            
            
            
            <a href="../../home.1">Documentation</a>
            
            <a href="../../../blog/index.html">Blog</a>
            
            <a href="../../../partners/index.html">Partners</a>
            
            <a href="../../../community/index.html">Community</a>
            
            <a href="../../../case-studies/index.html">Case Studies</a>
            
        </nav>
        <div class="social">
            <div>
                <a href="https://twitter.com/kubernetesio" class="twitter"><span>twitter</span></a>
                <a href="https://github.com/kubernetes/kubernetes" class="github"><span>Github</span></a>
                <a href="http://slack.k8s.io/" class="slack"><span>Slack</span></a>
            </div>
            <div>
                <a href="http://stackoverflow.com/questions/tagged/kubernetes" class="stack-overflow"><span>Stack Overflow</span></a>
                <a href="https://discuss.kubernetes.io" class="mailing-list"><span>Forum</span></a>
                <a href="https://calendar.google.com/calendar/embed?src=nt2tcnbtbied3l6gi2h29slvc0%40group.calendar.google.com" class="calendar"><span>Events Calendar</span></a>
            </div>
            <div>
                <a href="../../getting-started-guides/index.html" class="button">Get Kubernetes</a>
                <a href="https://git.k8s.io/community/contributors/guide" class="button">Contribute</a>
            </div>
        </div>
        <div id="miceType" class="center">
            &copy; 2018 The Kubernetes Authors | Documentation Distributed under <a href="https://git.k8s.io/website/LICENSE" class="light-text">CC BY 4.0</a>
        </div>
        <div id="miceType" class="center">
            Copyright &copy; 2018 The Linux Foundation&reg;. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our <a href="https://www.linuxfoundation.org/trademark-usage" class="light-text">Trademark Usage page</a>
        </div>
    </main>
</footer>

		<button class="flyout-button" onclick="kub.toggleToc()"></button>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-36037335-10', 'auto');
ga('send', 'pageview');


(function () {
    window.addEventListener('DOMContentLoaded', init)

        
        function init() {
            window.removeEventListener('DOMContentLoaded', init)
                hideNav()
        }

    function hideNav(toc){
        if (!toc) toc = document.querySelector('#docsToc')
        if (!toc) return
            var container = toc.querySelector('.container')

                
                if (container) {
                    if (container.childElementCount === 0 || toc.querySelectorAll('a.item').length === 1) {
                        toc.style.display = 'none'
                            document.getElementById('docsContent').style.width = '100%'
                    }
                } else {
                    requestAnimationFrame(function () {
                        hideNav(toc)
                    })
                }
    }
})();
</script>



	</body>
</html>